#include <bits/stdc++.h>
using namespace std;
int main()
{
  unordered_map<int,int> hash(26);
  string s;
  cin>>s;
  int n=s.size();
  char maxval;
  int maxcount=0;
  sort(s.begin(),s.end());
  for(int i=0;i<n;++i)
  {
    hash[s[i]-'a']++;
  }
  for(int i=n-1;i>=0;--i)
  {
    if(maxcount<hash[s[i]-'a'])
    {
      maxval=s[i];
      maxcount=hash[s[i]-'a'];
    }
  }
  cout<<maxval<<endl;
  cout<<maxcount;
  return 0;
}
